package io.datajek.springbasics.movierecommendersystem.lesson11;

import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
@Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE,proxyMode = ScopedProxyMode.TARGET_CLASS)
public class Movie {
    //用于计数创建的实例
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    private int id;
    private String name;
    private String genre;
    private String producer;

    public Movie(){
        super();
        logger.info("In Movie constructor method");
    }

    @PostConstruct
    private void postConstruct(){
        //初始化代码
        logger.info("In Movie postConstruct method");
    }

    @PreDestroy
    //用于清除的代码
    private void preDestroy(){
        //用于清除的代码
        logger.info("In Movie preDestroy method");
    }


    public double movieSimilarity(int movie1,int movie2){
        double similarity = 0.0;
        //如果genre相同，在相似度上加0.3
        //如果producer相同，在相似度上加0.5

        return similarity;
    }
}
